using Cinemachine;
using UnityEngine;

public class SwitchBounds : MonoBehaviour
{
    //TODO
    // Start is called before the first frame update
    void Start()
    {
        SwitchConfinerShaps();
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    // Switch Camera 2D Collision Confiner Bounding Shape  
    // CM vcam1 - Cinemachine Confiner - Bounding Shape 2D
    private void SwitchConfinerShaps() { 

        PolygonCollider2D confinerShape = GameObject.FindGameObjectWithTag("BoundsConfiner").GetComponent<PolygonCollider2D>();
        CinemachineConfiner cinemachineConfiner = GetComponent<CinemachineConfiner>();
        cinemachineConfiner.m_BoundingShape2D = confinerShape;
        // Call this if the bounding shape's points change at runtime
        cinemachineConfiner.InvalidatePathCache();
    }
}
